package Com.Hupochuan.Dal.Tab;

import java.util.Hashtable;
import java.util.List;
import java.util.Vector;

import Com.Hupochuan.Dal.DBManager.DBManager;
import Com.Hupochuan.Vo.HotPlayMovie;

public class HotPlayMovieTab {
	/*
	 * 本类私有对象
	 */
	private DBManager<HotPlayMovie> dbManager = new DBManager<HotPlayMovie>(HotPlayMovie.class);
	
	/*
	 * 单一实例
	 */
	private HotPlayMovieTab(){}
	private static HotPlayMovieTab hotPlayMovieTab = new HotPlayMovieTab();
	public static HotPlayMovieTab getObject(){
		return hotPlayMovieTab;
	}
	
	/*
	 * 查询热播电影列表
	 */
	public List<HotPlayMovie> findHotPlayMovieList(){
		
		//参数部分
		List<HotPlayMovie> hotPlayMovieList = new Vector<HotPlayMovie>();
		StringBuffer sqlBuff = new StringBuffer();
		Hashtable<String,Object> paraHash = new Hashtable<String,Object>();
		
		//sql语句部分
		sqlBuff.append(" select HotPlayMovie.*, ");
		sqlBuff.append(" 	Movie.name as movieName, ");
		sqlBuff.append(" 	Movie.byname as movieByname, ");
		sqlBuff.append(" 	Movie.logoPath as movieLogoPath ");
		sqlBuff.append(" from HotPlayMovie ");
		sqlBuff.append(" left join Movie on HotPlayMovie.movieId=Movie.id ");
		sqlBuff.append(" order by HotPlayMovie.weight desc,HotPlayMovie.id ");
		
		//执行sql 
		hotPlayMovieList = this.dbManager.querySqlReturnVoList(sqlBuff.toString(),paraHash);
		
		//返回列表
		return hotPlayMovieList;
	}
}
